主题
获取录制路径 - InputRecordGetPath
函数简介
获取本次 / 上次录制文件的绝对路径。InputRecord(START)(含自动命名)之后即可查询;STOP 落盘后路径仍有效,直到下次 START。
DLL 调用返回的字符串指针须释放(FreeStringPtr)。需要 InputSync 权限。
接口名称
InputRecordGetPathDLL调用
c
long InputRecordGetPath(long instance);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
ola.InputRecord(1, "");
// ...
ola.InputRecord(0, "");
std::string path = ola.InputRecordGetPath();csharp
using OLAPlug;
var ola = new OLAPlugServer();
ola.InputRecord(1, "");
ola.InputRecord(0, "");
string path = ola.InputRecordGetPath();python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
ola.InputRecord(1, "")
ola.InputRecord(0, "")
path = ola.InputRecordGetPath()java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
ola.InputRecord(1, "");
ola.InputRecord(0, "");
String path = ola.InputRecordGetPath();go
import "github.com/ola/olaplug/olaplug"
ola, _ := olaplug.NewOLAPlugServer("OLAPlug_x64.dll")
defer ola.ReleaseObj()
ola.InputRecord(1, "")
ola.InputRecord(0, "")
path := ola.InputRecordGetPath()rust
use olaplug::OLAPlugServer;
let ola = OLAPlugServer::new("OLAPlug_x64.dll").unwrap();
ola.input_record(1, "");
ola.input_record(0, "");
let path = ola.input_record_get_path();cpp
var ola = com("OlaPlug.OlaSoft")
ola.InputRecord(1, "");
ola.InputRecord(0, "");
var path = ola.InputRecordGetPath();vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ola.InputRecord(1, "")
ola.InputRecord(0, "")
path = ola.InputRecordGetPath()text
.局部变量 ola, OLAPlug
ola.创建 ()
ola.InputRecord(1, "")
ola.InputRecord(0, "")
path = ola.InputRecordGetPath()aardio
import OLAPlugServer;
var ola = OLAPlugServer();
ola.InputRecord(1, "");
ola.InputRecord(0, "");
var path = ola.InputRecordGetPath();text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
ola.InputRecord(1, "");
ola.InputRecord(0, "");
文本型 path = ola.InputRecordGetPath()cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
ola.InputRecord(1, "");
ola.InputRecord(0, "");
std::string path = ola.InputRecordGetPath();原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
InputRecord(instance, 1, "");
InputRecord(instance, 0, "");
long ptr = InputRecordGetPath(instance);
if (ptr != 0) {
char buffer[512] = {0};
GetStringFromPtr(ptr, buffer, sizeof(buffer));
FreeStringPtr(ptr);
}csharp
using System.Runtime.InteropServices;
using System.Text;
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long CreateCOLAPlugInterFace();
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int GetStringFromPtr(long ptr, StringBuilder lpString, int size);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int FreeStringPtr(long ptr);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int GetStringSize(long ptr);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int InputRecord(long instance, int action, string path);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long InputRecordGetPath(long instance);
long instance = CreateCOLAPlugInterFace();
InputRecord(instance, 1, "");
InputRecord(instance, 0, "");
long ptr = InputRecordGetPath(instance);
if (ptr != 0) {
StringBuilder sb = new StringBuilder(GetStringSize(ptr) + 1);
GetStringFromPtr(ptr, sb, sb.Capacity);
FreeStringPtr(ptr);
string path = sb.ToString();
}python
from ctypes import CDLL, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
ola.InputRecord(instance, 1, b"")
ola.InputRecord(instance, 0, b"")
ptr = ola.InputRecordGetPath(instance)
if ptr:
buf = create_string_buffer(512)
ola.GetStringFromPtr(ptr, buf, 512)
ola.FreeStringPtr(ptr)
path = buf.value.decode("utf-8")返回值
| 返回值 | 说明 |
|---|---|
非 0 | 成功,返回录制文件绝对路径的字符串指针。返回的字符串指针需要调用 FreeStringPtr 释放内存。 |
0 | 失败。 |
注意事项
| 项目 | 说明 |
|---|---|
| 释放内存 | 返回的字符串指针需要调用 FreeStringPtr 释放内存。 |
| 查询时机 | InputRecord(START) 之后即可查询;STOP 后路径仍有效,直到下次 START。 |
